package main

import "gitee.com/dreamwood/ez-maker/maker"

func Orders() {
	c := maker.CreateTable("Orders", "订单", "crm")
	c.AddText("sn", "订单号")
	c.AddManyToOne("buyer", "买方", "Buyer")
	c.AddManyToOne("seller", "卖方", "Seller")
	c.AddManyToOne("cat", "分类", "OrderCategory")

	//买了什么

	c.AddFloat("cost", "费用")
	c.AddManyToOne("status", "状态", "OrderStatus")
	c.AddCreateAt()
	c.AddUpdateAt()

	c.Generate()
}

func OrderProduct() {
	c := maker.CreateTable("OrderProduct", "订单产品", "crm")
	c.AddManyToOne("order", "订单", "Orders")
	c.AddManyToOne("product", "产品", "Product")
	c.AddFloat("num", "数量")
	c.AddFloat("price", "单价").SetDesc("实际单价")
	c.AddFloat("cost", "总价")
	//todo 交付数量
	c.Generate()
}

func OrderMoneyLog() {
	c := maker.CreateTable("OrderMoneyLog", "资金往来", "crm")
	c.AddManyToOne("order", "订单", "Orders")
	c.AddTitle()
	c.AddFloat("num", "金额/元")
	c.AddArt("content", "备注")
	c.AddFiles("assets", "附件")
	c.AddCreateAt()
	c.Generate()
}

func OrderLog() {
	c := maker.CreateTable("OrderLog", "订单进度", "crm")
	c.AddManyToOne("order", "订单", "Orders")
	c.AddName()
	c.AddSort()
	c.AddArt("content", "详情")
	c.AddFiles("assets", "附件")
	c.Generate()
}
